﻿@model CREAPA.Dominio.Relatorio
@{
    ViewBag.Title = "Relatório de Atividades do GRC";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<style>
		
		* {
			margin: 0;
			padding: 0;
		}

        fieldset.grupo {
			border: 0;
		}

		
		body, input, select, textarea, button {
			font-family: sans-serif;
			font-size: 1em;
		}

		.grupo:after {
			content: "."; 
			display: block; 
			height: 0;
			clear: both; 
			visibility: hidden;
		}

		.campo {
			margin-bottom: 1em;
		}
        
        .campo label {
			margin-bottom: 0.2em;
			color: #000;
			display: block;
            margin-left: 3px;
		}

		fieldset.grupo .campo {
			float: left;
			margin-right: 3em;
            margin-left: 3px;
		}

		.campo input[type="text"],
		.campo input[type="email"],
		.campo input[type="url"],
		.campo input[type="tel"] {
			padding: 0.2em;
			border: 1px solid #CCC;
			box-shadow: 2px 2px 2px rgba(0,0,0,0.2);
			display: block;
            width: 200%;
            margin-left: 3px;
		}
        .campo textarea {
			padding: 0.2em;
			border: 1px solid #CCC;
			box-shadow: 2px 2px 2px rgba(0,0,0,0.2);
			display: block;
            width: 525px;
            margin-left: 3px;
		}

		.campo select option {
			padding-right: 1em;
		}

		.campo input:focus, .campo select:focus, .campo textarea:focus {
			background: #ffffff;
		}

		.campo label.checkbox {
			color: #000;
			display: inline-block;
			margin-right: 1em;
		}
	
	</style>

@{    
    var grid = new WebGrid(ViewBag.ListaDeRelatorio, rowsPerPage: 500); 
}

<h2>@ViewBag.titulo</h2>

@using (Html.BeginForm("RelatorioGRCIndividual", "Relatorio", FormMethod.Post,
          new { enctype = "multipart/form-data" }))
{
 @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Relatório</legend>   

         <br />      
       <fieldset class="grupo"> 
                
        <div class="campo">
            Período:
            @Html.DropDownListFor(model => model.Mes,
                      new SelectList(new List<SelectListItem> {
                      new SelectListItem{Value="0", Text="Selecione"},
                      new SelectListItem{Value="100", Text="Data atual (hoje)"},
                      new SelectListItem{Value="1", Text="Janeiro"},                           
                      new SelectListItem{Value="2", Text="Fevereiro"},                           
                      new SelectListItem{Value="3", Text="Março"},                           
                      new SelectListItem{Value="4", Text="Abril"},                           
                      new SelectListItem{Value="5", Text="Maio"},                           
                      new SelectListItem{Value="6", Text="Junho"},                           
                      new SelectListItem{Value="7", Text="Julho"},                           
                      new SelectListItem{Value="8", Text="Agosto"},                           
                      new SelectListItem{Value="9", Text="Setembro"},                           
                      new SelectListItem{Value="10", Text="Outubro"},                           
                      new SelectListItem{Value="11", Text="Novembro"},                           
                      new SelectListItem{Value="12", Text="Dezembro"}}, "Value", "Text"))
        </div>
        
        <div class="campo">
            Ano:
            @Html.DropDownListFor(model => model.Ano,
                      new SelectList(new List<SelectListItem> {
                      new SelectListItem{Value=@DateTime.Now.Year.ToString(), Text=@DateTime.Now.Year.ToString()},                           
                      new SelectListItem{Value=(@DateTime.Now.Year-1).ToString(), Text=(@DateTime.Now.Year-1).ToString()}},                           
                                         "Value", "Text"))
        </div>      
        </fieldset>          
        
       <br />
        
        </fieldset> 
        <p>
            <input type="submit" value="Pesquisar"  class="button"/>
            @Html.ActionLink("Voltar", "Index", null, new { @class = "button2" })
        </p>
   
    
    if (ViewBag.ListaDeRelatorio != null)
    {        
        <p> <b>Total Pontuação Individual:</b> @String.Format("{0:n0}",@ViewBag.soma_ind) </p>
        <p> <b>Total Pontuação Setor:</b> @String.Format("{0:n0}",@ViewBag.soma_setor) </p>
        <p> <b>Percentual da Pontuação do funcionário no Setor:</b> @ViewBag.percentual %</p>
        if (@ViewBag.posicao != null) 
        {
            <p> <b>Classificação do funcionário no Setor:</b> @ViewBag.posicao</p>
        }
    
        <div id="grid" >
@grid.GetHtml(tableStyle: "table",
        alternatingRowStyle: "alternate",
        headerStyle: "header",
        footerStyle: "footer",
        mode: WebGridPagerModes.FirstLast | WebGridPagerModes.NextPrevious,
        firstText: "Primeiro",
        previousText: "Anterior",
        nextText: "Próximo",
        lastText: "Último",
    columns:
        grid.Columns(
            grid.Column("Descrição", format: @<text>@item.Descricao</text>),
            grid.Column("Total", header: "Total Setor", format: @<text><center>@String.Format("{0:n0}",@item.Total)</center></text>),
            grid.Column("Janeiro", header: "Total Individual", format: @<text><center>@String.Format("{0:n0}",@item.Janeiro)</center></text>)
))
</div>
    }
}


@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}


